package com.lxit.video.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.lxit.video.bean.VideoInfo;
import com.lxit.video.dao.VideoInfoRepository;
import com.lxit.video.service.VideoInfoService;

@Service
public class VideoInfoServiceImpl implements VideoInfoService {
	
	@Autowired
	private VideoInfoRepository videoInfoRepository;

	@Override
	public VideoInfo selectByVideoId(Integer vId) {
		return videoInfoRepository.selectByVideoId(vId);
	}

	@Override
	public List<VideoInfo> selectNewestVideos() {
		Pageable pageable = new PageRequest(0, 3);
		return videoInfoRepository.selectNewestVideos(pageable);
	}

	@Override
	public List<VideoInfo> selectHottestVideos() {
		Pageable pageable = new PageRequest(0, 3);
		return videoInfoRepository.selectHottestVideos(pageable);
	}

	@Override
	public List<VideoInfo> selectTypeHottestVideos(Integer voTypeId) {
		Pageable pageable = new PageRequest(0, 3);
		return videoInfoRepository.selectTypeHottestVideos(voTypeId,pageable);
	}
}
